package com.good.cardview

import androidx.annotation.ColorInt
import androidx.annotation.IntRange

/**
 * date        ：2020/8/25
 * author      ：蒙景博
 * description ：
 */
interface GoodCardLayoutDelegate {

    /**
     * 限制布局的宽度
     */
    fun setWidthLimit(widthLimit: Int): Boolean

    /**
     * 限制布局的高度
     */
    fun setHeightLimit(heightLimit: Int): Boolean

    /**
     * 确定轮廓是否包含填充区域，通常为false
     */
    fun setOutlineExcludePadding(outlineExcludePadding: Boolean)

    /**
     * 阴影海拔
     *
     * See [android.view.View.setElevation]
     */
    var shadowElevation: Int

    /**
     * 阴影透明度
     */
    var shadowAlpha: Float

    /**
     * 设置阴影颜色
     */
    var shadowColor: Int

    /**
     * 设置布局四个角的弧度半径，使其一侧不被隐藏
     *
     * @param radius
     * @param hideRadiusSide
     */
    fun setRadius(radius: Int, @GoodCardHideRadiusSide hideRadiusSide: Int)

    /**
     * 布局四个角的弧度半径
     */
    var radius: Int

    /**
     * 设置轮廊
     *
     * @param left
     * @param top
     * @param right
     * @param bottom
     */
    fun setOutlineInset(left: Int, top: Int, right: Int, bottom: Int)

    /**
     * 隐藏布局指定角的弧度
     *
     * @param hideRadiusSide
     */
    var hideRadiusSide: Int

    /**
     * this method will determine the radius and shadow.
     *
     * @param radius
     * @param shadowElevation
     * @param shadowAlpha
     */
    fun setRadiusAndShadow(radius: Int, shadowElevation: Int, shadowAlpha: Float)

    /**
     * this method will determine the radius and shadow with one or none side be hidden
     *
     * @param radius
     * @param hideRadiusSide
     * @param shadowElevation
     * @param shadowAlpha
     */
    fun setRadiusAndShadow(
        radius: Int,
        @GoodCardHideRadiusSide hideRadiusSide: Int,
        shadowElevation: Int,
        shadowAlpha: Float
    )

    /**
     * this method will determine the radius and shadow (support shadowColor if after android 9)with one or none side be hidden
     *
     * @param radius
     * @param hideRadiusSide
     * @param shadowElevation
     * @param shadowColor
     * @param shadowAlpha
     */
    fun setRadiusAndShadow(
        radius: Int,
        @GoodCardHideRadiusSide hideRadiusSide: Int,
        shadowElevation: Int,
        shadowColor: Int,
        shadowAlpha: Float
    )

    /**
     * 是否有边框
     */
    fun hasBorder(): Boolean

    /**
     * 设置边框颜色，如果不设置，则布局不会绘制边框
     */
    fun setBorderColor(@ColorInt borderColor: Int)

    /**
     * 设置边框宽度，默认为1px，通常无需设置
     */
    fun setBorderWidth(borderWidth: Int)

    /**
     * config the left divider
     */
    fun updateLeftDivider(
        insetTop: Int,
        insetBottom: Int,
        dividerWidth: Int,
        dividerColor: Int
    )

    /**
     * config the top divider
     */
    fun updateTopDivider(
        insetLeft: Int,
        insetRight: Int,
        dividerHeight: Int,
        dividerColor: Int
    )

    /**
     * config the right divider
     */
    fun updateRightDivider(
        insetTop: Int,
        insetBottom: Int,
        dividerWidth: Int,
        dividerColor: Int
    )

    /**
     * config the bottom divider
     */
    fun updateBottomDivider(
        insetLeft: Int,
        insetRight: Int,
        dividerHeight: Int,
        dividerColor: Int
    )

    /**
     * show left divider, and hide others
     */
    fun onlyShowLeftDivider(
        insetTop: Int,
        insetBottom: Int,
        dividerWidth: Int,
        dividerColor: Int
    )

    /**
     * show top divider, and hide others
     */
    fun onlyShowTopDivider(
        insetLeft: Int,
        insetRight: Int,
        dividerHeight: Int,
        dividerColor: Int
    )

    /**
     * show right divider, and hide others
     */
    fun onlyShowRightDivider(
        insetTop: Int,
        insetBottom: Int,
        dividerWidth: Int,
        dividerColor: Int
    )

    /**
     * show bottom divider, and hide others
     */
    fun onlyShowBottomDivider(
        insetLeft: Int,
        insetRight: Int,
        dividerHeight: Int,
        dividerColor: Int
    )

    /**
     * @param dividerAlpha [0, 255]
     */
    fun setLeftDividerAlpha(
        @IntRange(
            from = 0,
            to = 255
        ) dividerAlpha: Int
    )

    /**
     * after config the border, sometimes we need change the alpha of divider with animation,
     * so we provide a method to individually change the alpha
     *
     * @param dividerAlpha [0, 255]
     */
    fun setTopDividerAlpha(@IntRange(from = 0, to = 255) dividerAlpha: Int)

    /**
     * @param dividerAlpha [0, 255]
     */
    fun setRightDividerAlpha(@IntRange(from = 0, to = 255) dividerAlpha: Int)

    /**
     * @param dividerAlpha [0, 255]
     */
    fun setBottomDividerAlpha(@IntRange(from = 0, to = 255) dividerAlpha: Int)

    /**
     * update left separator color
     *
     * @param color
     */
    fun updateLeftSeparatorColor(color: Int)

    /**
     * update top separator color
     *
     * @param color
     */
    fun updateTopSeparatorColor(color: Int)

    /**
     * update right separator color
     *
     * @param color
     */
    fun updateRightSeparatorColor(color: Int)

    /**
     * update bottom separator color
     *
     * @param color
     */
    fun updateBottomSeparatorColor(color: Int)

    /**
     * 是否显示底部边框
     */
    fun hasLeftSeparator(): Boolean

    /**
     * 是否有顶部边框
     */
    fun hasTopSeparator(): Boolean

    /**
     * 是否显示底部边框
     */
    fun hasRightSeparator(): Boolean

    /**
     * 是否显示底部边框
     */
    fun hasBottomSeparator(): Boolean
}